package org.drushpal.service.commands
{
	import mx.collections.ArrayCollection;
	
	import org.drushpal.model.vo.Status;
	import org.drushpal.service.DrushService;
	import org.robotlegs.mvcs.Command;
	
	public class StatusCommand extends Command
	{
		[Inject]public var drushService:DrushService;
		[Inject]public var event:DrushCommandEvent;
		override public function execute():void{
			var stats:Array = event.output.split("\n");
			drushService.statusCollection = new ArrayCollection();
			for each(var stat:String in stats){
				var arrStat:Array = stat.split("=");
				if(arrStat.length==2){
					var status:Status = new Status();
					status.name = arrStat[0];
					status.info = arrStat[1];
					drushService.statusCollection.addItem(status);
				}
			}
		}
	}
}